<template>
    <view>
        <view class="section-box" v-for="(dayData,index) in newList" :key="index">
            <view class="section-title">{{ dayData.currentDate }}上新</view>
            <view class="list-container">
                <item :item="item" v-for="(item,index) in dayData.goods" :key="index"></item>
            </view>
        </view>
		<view class="tips" v-show="newList.length === 0">
			最近没有新品上线哦
		</view>
    </view>
</template>

<script>
import Api from '@/common/api';
import item from '@/components/langwen/item'
export default {
	name: 'newGoods',
    components: {
        item
    },
    data() {
        return {
            newList: '',
			pageNum: 1,
			pageSize: 5
        }
    },
    created() {
        this.getNewList('headerRefreshing');
    },
    methods: {
        // 上新
        async getNewList(sign) {
			if(sign == 'headerRefreshing') {
				this.pageNum = 1;
			} else {
				this.pageNum ++;
			}
            var params = {
                'pageNum': this.pageNum,
                'pageSize':	this.pageSize
            };
            var data = await Api.apiCall('get', Api.goods.findNewGoods, params);
			if(this.pageNum == 1) {
				this.newList = [];
			}
            this.newList = this.newList.concat(data.records);
        }
    }
}
</script>

<style lang="less">
.section-box {
    margin-bottom: 20upx;
}

.section-title {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 90rpx;
    font-size:12px;
    font-weight:400;
    color:rgba(51,51,51,1);
}

.list-container {
    display: flex;
    flex-wrap: wrap;
    background:rgba(255,255,255,1);
    box-shadow:0px 2rpx 16rpx 0px rgba(0,0,0,0.02);
	border-radius:10px;
}

.tips {
	padding-top: 160rpx;
	text-align: center;
	font-size: 28rpx;
}
</style>